<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>手风琴</title>
    <script src="https://unpkg.com/vue@2/dist/vue.js"></script>
    <link rel="stylesheet" href="./assets/fonts/iconfont.css" />
  </head>
  <style>
    *{
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    body {
     
      background-color: #f3f5f7;
      
    }
    .accordion {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      display: flex;
      gap: 20px;
    }
    .accordion-item {
      user-select: none;
      display: flex;
      align-items: center;
      background-color: #fff;
      border-radius: 40px;
      transition: all 1s ease;
      .accordion-item-content {
        width: 0;
        padding: 0;
        transition: all 0.5s ease;
        overflow: hidden;
      }
      .accordion-item-icon {
        width: 50px;
        height: 50px;
        line-height: 50px;
        text-align: center;
        font-size: 20px;
        border-radius: 50%;
        background-color: #fff;
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
        transition: all 0.5s ease;
      }
      .accordion-item-content {
        font-size: 13px;
      }
      &:hover {
        .accordion-item-content {
         width: 90px;
          padding: 0 13px;
        }
        .accordion-item-icon {
          background-color: #007bff;
          color: #fff;
          cursor: pointer;
          box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
        }
      }
    }
  </style>
  <body>
    <div id="app">
      <div class="accordion">
        <div class="accordion-item" v-for="item in accordionList">
          <div class="accordion-item-icon iconfont" :class="item.icon"></div>
          <div class="accordion-item-content">{{item.content}}</div>
        </div>
      </div>
    </div>
  </body>
  <script>
    new Vue({
      el: "#app",
      data: function () {
        return {
          accordionList: [
            {
              icon: "icon-facebook",
              content: "Facebook",
            },
            {
              icon: "icon-Instagram",
              content: "Instagram",
            },
            {
              icon: "icon-twitter-fill",
              content: "Twitter",
            },
            {
              icon: "icon-whatsapp",
              content: "WhatsApp",
            },
            {
              icon: "icon-Youtube",
              content: "YouTube",
            },
          ],
        };
      },
    });
  </script>
</html>
